<template>
    <div>
        <Form :model="formItem" label-position="top">
            <FormItem label="管控措施" :required="true">
                <Input v-model="formItem.measures" placeholder="请输入管控措施" :disabled="type == 'detail' ? true : false"></Input>
            </FormItem>
            <FormItem label="措施类型" :required="true">
                <Select v-model="formItem.measureType" :disabled="type == 'detail' ? true : false">
                    <Option value="1">管理</Option>
                    <Option value="2">技术</Option>
                </Select>
            </FormItem>
            <FormItem label="频次">
                <Select v-model="formItem.frequencyId" :disabled="type == 'detail' ? true : false">
                    <Option v-for="item in list" :key="item.id" :value="item.id">{{item.frequencyName}}</Option>
                </Select>
            </FormItem>
            <FormItem label="动态管控岗" v-if="type=='detail'">
                <Table border :columns="columns1" :data="data1">
                    <template slot-scope="{ row, index }" slot="action">
                        <a class="action-button">不涉及</a>
                        <a class="action-button">详情</a>
                    </template>
                </Table>
            </FormItem>
            <FormItem style="text-align:center;margin-left:0;" v-if="type!='detail'">
                <Button type="primary" @click="submit">提交</Button>
                <Button style="margin-left: 20px" @click="$emit('detailModal',false)">取消</Button>
            </FormItem>
        </Form>
    </div>
</template>
<script>
export default {
    props:['type'],
    data(){
        return{
            list:[],
            formItem:{
                projectDepartmentControllerName:'',
                projectDepartmentDeputyLeaderName:'',
                projectDepartmentLeaderName:'',
            },
            data1: [],
            columns1: [
                {
                    title: '项目管控部门',
                    key: 'name',
                    align: 'center'
                },
                {
                    title: '项目部分管领导',
                    key: 'age',
                    align: 'center'
                },
                {
                    title: '项目部主管领导',
                    key: 'address',
                    align: 'center'
                },
                {
                    title: '工程公司管控部门',
                    key: 'address',
                    align: 'center'
                },
                {
                    title: '工程公司分管领导',
                    key: 'address',
                    align: 'center'
                },
                {
                    title: '集团公司管控部门',
                    key: 'address',
                    align: 'center'
                },
                {
                    title: '集团公司分管领导',
                    key: 'address',
                    align: 'center'
                },
            ],
        }
    },
    mounted(){
        this.frequencyList()
    },
    methods:{
        submit(){
            if(!this.formItem.measures){
                return this.$Message.warning('管控措施不能为空')
            }else if(!this.formItem.measureType){
                return this.$Message.warning('请选择措施类型')
            }
            this.$emit('detailModal',false)
            this.$emit('detailModalObj',this.formItem)
        },
        frequencyList(){
            this.$api.MonthlyDynamics.frequencyList().then(resp=>{
                if(resp.code == 200){
                    this.list = resp.data
                }
            })
        }
    }
}
</script>